package com.luo.shop.controller;

import com.luo.shop.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
@RequestMapping("goods")
public class GoodsController {
    @Autowired
    private GoodsService goodsService;

    @GetMapping("queryByCid")
    public String queryByCid(
            Model model,
            @RequestParam(value = "cid") Long cid,
            @RequestParam(value = "createtime")  Boolean createtime,
            @RequestParam(value = "price")  Boolean price
    ){
        model.addAttribute("goods",goodsService.queryByCid(cid,createtime,price));
        return "oppo_phone";
    }

}
